package com.example.nophase.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.nophase.R;
import com.example.nophase.entity.ProjectDetailDTO;
import com.example.nophase.entity.ProjectListItem;


import java.util.List;

public class ProjectListAdapter extends BaseAdapter {
    Context context;
    List<ProjectDetailDTO> projectListItemList;

    public ProjectListAdapter(List<ProjectDetailDTO> projectListItemList, Context context) {
        this.projectListItemList = projectListItemList;
        this.context = context;
    }

    @Override
    public int getCount() {
        return projectListItemList.size();
    }

    @Override
    public Object getItem(int position) {
        return projectListItemList.get(position);
    }

    @Override
    public long getItemId(int position) {
        return position;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        View view = LayoutInflater.from(context).inflate(R.layout.project_list_item, null);
        //获取ListView中Image对象

        //获取ListView中的TextView对象
        TextView projectNo = (TextView) view.findViewById(R.id.applyfor_lv_item_num);
        TextView projectAppMoney = (TextView) view.findViewById(R.id.applyfor_lv_money);
        TextView projectAdultMoney = (TextView) view.findViewById(R.id.applyfor_lv_item_date);
//        TextView projectCause = (TextView) view.findViewById(R.id.applyfor_lv_item_cause);

        projectNo.setText(projectListItemList.get(position).getProName());
        projectAppMoney.setText(String.valueOf(projectListItemList.get(position).getAppMoney())+"元");
//        projectCause.setText(projectListItemList.get(position).getAppReason());
        projectAdultMoney.setText(String.valueOf(projectListItemList.get(position).getAuditMoney())+"元");
        return view;

    }
}
